import store from '@/store'

export default function forbid(value) {
  const roles = store.getters && store.getters.roles && [localStorage.getItem("roleName")]
  if (value && value instanceof Array && value.length > 0) {
    const permissionRoles = value
    const hasPermission = roles.some(role => {
      return permissionRoles.includes(role)
    })
    if (!hasPermission) {
      return true
    }
  } else {
    throw new Error(`需要的角色!像v-permission = "['超级管理员','代理商']"`)
  }
}
